﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Setor.aspx.cs" Inherits="TVH.Cadastro.Setor"
    MasterPageFile="~/Site.master" %>

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="body">
    <asp:HiddenField ID="hdnID" runat="server" />
    <h1>
        Cadastro de Setor</h1>
    <asp:Label ID="lblMensagem" runat="server"></asp:Label>
    <fieldset>
        <legend>Dados do Setor</legend>
        <div class="field">
            <label>
                Descrição:</label>
            <asp:TextBox runat="server" ID="txtDescricao" MaxLength="30" CssClass="input-size-350" />
            <asp:RequiredFieldValidator ValidationGroup="Salvar"    ID="txtDescricaoRequiredFieldValidator" runat="server"
                ControlToValidate="txtDescricao" ErrorMessage="*" SetFocusOnError="True" CssClass="erro"></asp:RequiredFieldValidator>
        </div>
        <div class="field">
            <label>
                Categoria:</label>
            <asp:DropDownList runat="server" ID="ddlCategoria" CssClass="size-350" AppendDataBoundItems="true">
                <asp:ListItem Text="Selecione" Value="0" />
            </asp:DropDownList>
            <asp:RequiredFieldValidator ID="ddlCategoriaRequiredFieldValidator" runat="server"
                ControlToValidate="ddlCategoria" InitialValue="0" ErrorMessage="*" SetFocusOnError="True"
                CssClass="erro" ValidationGroup="Adicionar"></asp:RequiredFieldValidator>
            <asp:Button ID="btnAdicionar" Text="+" CssClass="botao-azul" runat="server" ValidationGroup="Adicionar" OnClick="btnAdicionar_Click" />
        </div>
        <div class="field">
        <asp:GridView runat="server" ID="gridResultado" AutoGenerateColumns="false"
            CssClass="grid" BorderWidth="0" GridLines="None" DataKeyNames="ID" PagerSettings-Position="TopAndBottom"
            AlternatingRowStyle-CssClass="odd"
            OnRowDataBound="gridResultado_RowDataBound" OnRowDeleting="gridResultado_RowDeleting"
            EmptyDataText="Não há categoria associada.">
            
            <Columns>
                <asp:BoundField HeaderText="Categorias Associadas" DataField="DescricaoCategoria" />
                <asp:TemplateField HeaderText="Excluir" ItemStyle-CssClass="center" HeaderStyle-CssClass="icon-header">
                    <ItemTemplate>
                        <asp:LinkButton CausesValidation="false" ID="lnkExcluir" CommandArgument='<%# Eval("ID") %>' CommandName="Delete"
                            runat="server">
                            <img alt="Excluir" runat="server" id="imgExcluir" src="~/img/ico-delete.png" />
                        </asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        </div>
    </fieldset>
    <div class="actions">
        <a href="ListaSetor.aspx" class="button botao-cinza">Voltar</a>
        <asp:Button ID="btnSalvar" Text="Salvar" ValidationGroup="Salvar" CssClass="botao-azul" runat="server" OnClick="btnSalvar_Click" />
    </div>
        <script type="text/javascript">
            $(document).ready(function () {
            });
    </script>
</asp:Content>
